
var checkAndUpdate = {
    checkLogin : function(){
        var token = $.cookie("token");
        if(!token){
            return ;
        }
        $.ajax({
            url : "/login/checkLogin/" + token,
            dataType : "json",
            type : "GET",
            success : function(data){
                var html = "<li class=\"nav-item\"> <a href=\"/index/personalMessage\" > <span class=\"title\"> 个人主页 </span> </a></li>"
                    +"<li class=\"nav-item\"> <a href=\"\logout\" > <span class=\"title\"> 退出登陆 </span> </a></li>";
                $("#loginAndRegisterLi").before(html);
                $("#loginAndRegister").remove();
            }
        });
    }
}

$(function(){
    checkAndUpdate.checkLogin();
})
